package com.example.mybatisplusdemo.Service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mybatisplusdemo.Service.UserService;
import com.example.mybatisplusdemo.mapper.UserMapper;
import com.example.mybatisplusdemo.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Autowired
    UserService userService;

    @Override
    public Boolean checktoken(String str) {
        List<User> tokens = userService.list(new QueryWrapper<User>().select("token"));
        for (User t:tokens ){
            if (t.getToken().equals(str)){
                return true;
            }
        }
        return false;
    }
}
